import socket
import datetime

HOST='0.0.0.0'
PORT=3434

s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind((HOST,PORT))
s.listen(1)

while True:
    conn,addr=s.accept()
    print("%s 建立了连接"%(str(addr)))
    dt=datetime.datetime.now()
    message="当前时间是"+str(dt)
    conn.send(bytes(message,encoding='utf-8'))
    print("发送了消息："+message)
    conn.close()